package com.example.zhanglinan.vrdemo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.example.zhanglinan.vrdemo.R;
import com.facebook.drawee.view.SimpleDraweeView;


public class VideoDetailActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_detail);
        initView();
    }

    private void initView() {
        String title = getIntent().getStringExtra("title");
        String img = getIntent().getStringExtra("img");
        String text = getIntent().getStringExtra("text");
        final String play = getIntent().getStringExtra("play");

        TextView tvTitle = (TextView) findViewById(R.id.title_text);
        SimpleDraweeView ivImg = (SimpleDraweeView) findViewById(R.id.detail_img_view);
        TextView tv_detail = (TextView) findViewById(R.id.detail_text);
        ImageButton button = (ImageButton) findViewById(R.id.play_link);

        tvTitle.setText(title);
        ivImg.setImageURI(img);
        tv_detail.setText(text);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(VideoDetailActivity.this, VideoPlayerActivity.class);
                intent.putExtra("play", play);
                startActivity(intent);
            }
        });
    }
}
